package com.acme.bankapp.domain.bank;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import com.acme.bankapp.service.bank.ClientRegistrationListener;

public class Bank {

	private List<Client> clients = new ArrayList<>();
	private List<ClientRegistrationListener> listeners = new ArrayList<>();

	public void addClientRegistrationListener(ClientRegistrationListener listener) {
		listeners.add(listener);
	}
	
	public void addClient(Client client) {
		clients.add(client);

		for (ClientRegistrationListener listener : listeners) {
			listener.onClientAdded(client);
		}
	}
	
	public List<Client> getClients() {
		return Collections.unmodifiableList(clients);
	}

}
